'''
Created on Apr 3, 2014

@author: yfrank
'''
import logging

# create root_logger
root_level = logging.INFO
root_logger = logging.getLogger('root_logger')
root_logger.setLevel(root_level)

# create console handler and set level to debug

ch = logging.StreamHandler()
ch.setLevel(root_level)

# create formatter
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

# add formatter to ch
ch.setFormatter(formatter)

# add ch to root_logger
root_logger.addHandler(ch)


def log(msg): root_logger.log(root_level, msg)

def set_root_level(level): root_level = level

def get_root_level(levle): return root_level